import { request } from "@/utils/service"
import { getToken } from "@/utils/cache/cookies"

import axios from "axios"
const baseURL = import.meta.env.VITE_BASE_API
/** 查询签名 */
export function seeMsgSign(params: any) {
  return request<any>({
    url: "/data/noteSign/query",
    method: "get",
    params
  })
}

//新增签名
export function addMsgSign(data: any) {
  return request({
    url: `/data/noteSign/add`,
    method: "post",
    data
  })
}
//增加短信模板
export function addMsgTmp(data: any) {
  return request({
    url: `/data/noteTem/add`,
    method: "post",
    data
  })
}
//查询模板
/** 查询签名 */
export function seeMsgTmp(params: any) {
  return request<any>({
    url: "/data/noteTem/query",
    method: "get",
    params
  })
}

//修改短信模板
export function editMsgTmp(data: any) {
  return request({
    url: `/data/noteTem/update`,
    method: "put",
    data
  })
}

//删除

export function delMsgTmp(temId: string) {
  return request({
    url: "/data/noteTem/del",
    method: "delete",
    params: {
      temId
    }
  })
}
//下载变量模板
export function downLoadVarTmp(data: any) {
  return axios({
    url: `${baseURL}/data/smsTp/SmsSendTemplate`,
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data,
    responseType: "blob"
  })
}
//短信发送-号码
export function sendMsgNum(data: any) {
  return request({
    url: `/data/smsTp/SendSmsTp`,
    method: "post",
    data
  })
}

//短信发送-文件
export function sendMsgFile(data: any) {
  console.log(data)
  return request({
    url: `/data/smsTp/SendSmsTplist`,
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}
/**新增签名接口 */
export function addInterFaceSet(data: any) {
  return request({
    url: `/data/noteUser/add`,
    method: "post",
    data
  })
}

/** 查询签名接口 */
export function seeInterFaceSet(params: any) {
  return request<any>({
    url: "/data/noteUser/query",
    method: "get",
    params
  })
}

/** 修改短信模板 */
export function editInterFaceSet(data: any) {
  return request({
    url: `/data/noteUser/update`,
    method: "put",
    data
  })
}

/**删除 */

export function delInterFaceSet(id: string) {
  return request({
    url: "/data/noteUser/del",
    method: "delete",
    params: {
      id
    }
  })
}
